//
//  WmcQRCodeVerifyGuideView.swift
//  YPWatermarkCamera
//
//  Created by Json on 2023/7/26.
//

import UIKit

class WmcQRCodeVerifyGuideView: WmcBubbleGuideView {
    
    
    // MARK: UI
    override func makeUI() {
        super.makeUI()
        
        lineView.image = "icon_point_line_up".wmc_image
        bubbleView.message = "增加二维码扫描验证真实性功能点击可进行设置"
        bubbleView.buttonTitle = "我知道了"
        bubbleView.buttonW = 78.0.wmc_autoHor
    }
    
    /// 布局子控件
    override func _layoutSubviews() {
        let lineW: CGFloat = 14.0
        let lineH: CGFloat = 54.0
        let bubbleW = 215.0.wmc_autoHor
        let bubbleR = 16.0.wmc_autoHor
        let lineL = maskFrame.minX + (maskFrame.width - lineW) * 0.5
        
        lineView.snp.remakeConstraints { make in
            make.top.equalTo(maskFrame.maxY)
            make.width.equalTo(lineW)
            make.height.equalTo(lineH)
            make.left.equalTo(lineL)
        }
       
        bubbleView.snp.remakeConstraints { make in
            make.top.equalTo(lineView.snp.bottom).offset(3.0.wmc_autoHor)
            make.width.equalTo(bubbleW)
            make.right.equalTo(-bubbleR)
        }
        // 气泡距离父控件左边间距
        let bubbleL = viewWidth - bubbleR - bubbleW
        // 箭头中心点x坐标的默认位置
        let oldArrowCenterX = bubbleL + bubbleW * 0.5
        // 箭头中心点x坐标的目标位置
        let newArrowCenterX = maskFrame.midX
        // 计算偏移量
        let offsetX = newArrowCenterX - oldArrowCenterX
        // 更新气泡箭头中心x坐标偏移量
        bubbleView.arrowOffsetX = offsetX
    }
}


    
    

